package se.liu.oschi129.game.objects;

import java.awt.Shape;
import java.awt.geom.Rectangle2D;

import se.liu.johfa428.levelstate.LevelState;
import se.liu.oschi129.animation.animationspace.AnimationSpace;
import se.liu.oschi129.shapefactory.ShapeFactory;
import se.liu.oschi129.world.objects.WorldStaticObject;

/**
 * This is a level goal.
 * 
 * @author oschi129
 */
public class ObjectGoal extends WorldStaticObject {

	// The levelState stored in the object
	private LevelState levelState;
	
	/**
	 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	 * - - - - - - - - - - - - Constructors - - - - - - - - - - - 
	 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	 */
	
	public ObjectGoal(LevelState levelState, double x, double y) {
		super(Type.SOFT, AnimationSpace.get("img_goal01"), true, x,y,32,176);
		setMaskFactory(new DefaultMask());
		this.levelState = levelState;
	}
	
	/**
	 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	 * - - - - - - - - - - - Public methods - - - - - - - - - - 
	 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	 */
	
	public LevelState getLevelState() {
		return levelState;
	}
	
	/**
	 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	 * - - - - - - - - - - Private classes - - - - - - - - - - -
	 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	 */

	private class DefaultMask implements ShapeFactory {

		public Shape makeShape(double x, double y, double width, double height) {
			return new Rectangle2D.Double(x+8,y,width-16,height);
		}

	}
	
}
